<?php

namespace common\models\base;

use Yii;

/**
 * This is the model class for table "{{%multi_media_order_bank_back_log}}".
 *
 * @property int $id
 * @property string $for_serial_number
 * @property int $created_at
 * @property string $request_data
 * @property string $check_error_data 银行回调检查错误信息
 *
 * @property MultiMediaOrderLog $forSerialNumber
 */
class MultiMediaOrderBankBackLog extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%multi_media_order_bank_back_log}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['for_serial_number', 'created_at'], 'required'],
            [['created_at'], 'integer'],
            [['request_data', 'check_error_data'], 'string'],
            [['for_serial_number'], 'string', 'max' => 20],
            [['for_serial_number'], 'exist', 'skipOnError' => true, 'targetClass' => MultiMediaOrderLog::className(), 'targetAttribute' => ['for_serial_number' => 'serial_number']],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'for_serial_number' => Yii::t('app', 'For Serial Number'),
            'created_at' => Yii::t('app', 'Created At'),
            'request_data' => Yii::t('app', 'Request Data'),
            'check_error_data' => Yii::t('app', '银行回调检查错误信息'),
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getForSerialNumber()
    {
        return $this->hasOne(MultiMediaOrderLog::className(), ['serial_number' => 'for_serial_number']);
    }
}
